Ext.define('GBIF.ProcessWindow', {
		extend: 'Ext.window.Window'	
	,	alias: 'widget.processWindow'
	,	width: 500
	,	height: 390
	,	iconCls: 'icon_gbif'
	,	layout: 'fit'
	,	closable: true
	,	draggable: false
	,	resizable: false	
	,	modal: true
	,	mode: 'close'
	,	initComponent: function() {

			var comboStore = Ext.create('Ext.data.Store', {
					model: 'CheckListModel'
				,	autoLoad: true	
				,	proxy: {
							type: 'scripttag'
						,	url: 'http://ecat-dev.gbif.org/ws/checklist/'
						,	reader: {
									type: 'json'
								,	root: 'data'
							}
					}	
			});

			comboStore.on('load', function(store, records, success, ope, opt){
				if(!this.firstLoaded){
					this.primaryCombo.setValue(Config.pAuth);
					this.secondaryCombo.setValue(Config.sAuth);
					this.firstLoaded = true;
				}
			}, this);

			this.fbar = [{ 
					type: 'button'
				, text: this.txtBeginClassification
				,	iconCls: 'icon_page_find'				
				,	handler: function(me) {
						me.ownerCt.ownerCt.mode = 'process';
						me.ownerCt.ownerCt.close();
					}
			}, {
					type: 'button'
				, text: this.txtCancel
				,	handler: function() {
						this.ownerCt.ownerCt.mode = 'close';
						this.ownerCt.ownerCt.close();
					}
			}]

			this.primaryCombo = Ext.create('Ext.form.field.ComboBox', {
					store: comboStore
				,	queryMode: 'local'
				,	displayField: 'authority'
				,	valueField: 'id'
				,	fieldLabel: this.txtPrimaryAuthority
				,	name: 'primary'
				,	width: 450
				,	labelWidth: 135
				,	typeAhead: false
				,	triggerAction: 'all'
				,	editable: false
			});
			
			this.secondaryCombo = Ext.create('Ext.form.field.ComboBox', {
					store: comboStore
				,	fieldLabel: this.txtSecondaryAuthority  
				,	queryMode: 'local'
				,	displayField: 'authority'
				,	name: 'secondary'
				,	valueField: 'id'
				,	width: 450
				,	labelWidth: 135
				,	typeAhead: false
				,	triggerAction: 'all'
				,	editable: false
			});
			
			this.pidForm = Ext.create('Ext.form.Panel', {
					border: false
				,	defaultType: 'textfield'
				,	bodyPadding: 10
				,	fieldDefaults: {
							labelAlign: 'left'
						,	labelWidth: 50
						,	hideEmptyLabel: true
					}
				,	items: [{
							xtype: 'displayfield'
						,	value: '<div style="padding-bottom:5px;">' + this.txtLoadProjectInfo +'</div>'
					}, {
							boxLabel: this.txtHigherTaxa
						,	name: 'highertaxa'
						,	inputValue: '1'
						,	checked: true
						,	xtype: 'checkbox'
					}, this.primaryCombo, this.secondaryCombo, {
							boxLabel: this.txtQuickMode
						,	name: 'quickmode'
						,	inputValue: '1'
						,	checked: false
						,	xtype: 'checkbox'
					}, {
							xtype: 'displayfield'
						,	value: '<div style="padding-bottom:5px;">' + this.txtQuickModeInfo +'</div>'
					}, {
							xtype: 'radiogroup'
						,	columns: 1
						,	items: [
									{boxLabel: this.txtAllAuthor, name: 'authorship', inputValue: 1, checked: true}
								,	{boxLabel: this.txtMissingAuthor, name: 'authorship', inputValue: 2}
								,	{boxLabel: this.txtNoAuthor, name: 'authorship', inputValue: 0}
							]
					}]
			});

			this.items = [ this.pidForm ]
			this.callParent();
		}
});